Skip to content

fix(oxlint): Skip vite.config.ts w/o .lint field in auto-discovery#20255

Merged
graphite-app[bot] merged 1 commit intomainfrom
03-12-fix_oxlint_skip_vite.config.ts_w_o_.lint_field_in_auto-discovery
Mar 12, 2026
Merged

fix(oxlint): Skip vite.config.ts w/o .lint field in auto-discovery#20255
graphite-app[bot] merged 1 commit intomainfrom
03-12-fix_oxlint_skip_vite.config.ts_w_o_.lint_field_in_auto-discovery

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Mar 12, 2026

The same as #20254 for Oxlint.

The refactoring to move the logic to the JS side is being addressed in a subsequent PR. (Copilot review will be also addressed)

@leaysgur leaysgur requested a review from camc314 as a code owner March 12, 2026 02:40
Copy link
Member Author

leaysgur commented Mar 12, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-bug Category - Bug labels Mar 12, 2026
@leaysgur leaysgur changed the title fix(oxlint): Skip vite.config.ts w/o .lint field in auto-discovery fix(oxlint): Skip vite.config.ts w/o .lint field in auto-discovery Mar 12, 2026
@leaysgur leaysgur force-pushed the 03-12-fix_oxfmt_skip_vite.config.ts_w_o_.fmt_field_in_auto-discovery branch from 2308d45 to 079cd61 Compare March 12, 2026 02:52
@leaysgur leaysgur force-pushed the 03-12-fix_oxlint_skip_vite.config.ts_w_o_.lint_field_in_auto-discovery branch from e58c283 to 2f76cfd Compare March 12, 2026 02:52
@leaysgur leaysgur requested a review from Copilot March 12, 2026 02:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates oxlint’s config auto-discovery so that a vite.config.ts without a .lint field is treated as “not an oxlint config” (skip and continue searching), while keeping explicit --config vite.config.ts behavior as an error.

Changes:

  • Add try_load_root_vite_config to skip auto-discovered vite.config.ts when .lint is missing and continue ancestor search.
  • Add/adjust CLI fixture coverage for both auto-discovery skip and explicit --config error behavior.
  • Add an LSP fixture verifying that a child vite.config.ts without .lint doesn’t block finding a parent .oxlintrc.json.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/oxlint/src/config_loader.rs Implements vite-config auto-discovery skipping logic via try_load_root_vite_config.
apps/oxlint/src/js_config.rs Documents the diagnostic string relied upon for vite-config skip detection.
apps/oxlint/test/lsp/lint/lint.test.ts Adds a new LSP fixture case to the parameterized config test matrix.
apps/oxlint/test/lsp/lint/snapshots/lint.test.ts.snap Snapshot for the new LSP fixture diagnostics.
apps/oxlint/test/lsp/lint/fixtures/vite-config-skip-finds-parent/.oxlintrc.json Parent config used to prove ancestor search continues past a non-oxlint vite config.
apps/oxlint/test/lsp/lint/fixtures/vite-config-skip-finds-parent/child/vite.config.ts Child vite config missing .lint to trigger the skip behavior.
apps/oxlint/test/lsp/lint/fixtures/vite-config-skip-finds-parent/child/test.js Lint target verifying parent config is applied.
apps/oxlint/test/fixtures/vite_config_no_lint_field/output.snap.md Updates expected CLI behavior for auto-discovery (no longer fails on missing .lint).
apps/oxlint/test/fixtures/vite_config_explicit_no_lint_field/vite.config.ts Adds explicit-config fixture vite file missing .lint.
apps/oxlint/test/fixtures/vite_config_explicit_no_lint_field/options.json Runs oxlint with --config vite.config.ts to assert error behavior.
apps/oxlint/test/fixtures/vite_config_explicit_no_lint_field/files/test.js Lint target for the explicit-config fixture.
apps/oxlint/test/fixtures/vite_config_explicit_no_lint_field/output.snap.md Snapshot asserting explicit --config still errors on missing .lint.
Comments suppressed due to low confidence (1)

apps/oxlint/src/js_config.rs:137

  • The new coupling note here makes parse_js_config_response responsible for keeping an exact error string stable for config auto-discovery. To reduce long-term maintenance risk, consider tagging this diagnostic with an explicit OxcDiagnostic error code (e.g. with_error_code("oxlint", "missing_vite_lint_field")) so ConfigLoader can reliably identify and skip this specific condition without depending on the message text.
                            // NOTE: This error message is shown to users (explicit `--config`) and also
                            // matched by `try_load_root_vite_config` in config_loader.rs (auto-discovery skip).
                            errors.push(OxcDiagnostic::error(format!(
                                "Expected a `{VITE_OXLINT_CONFIG_FIELD}` field in the default export of {}",
                                entry.path
                            )));

You can also share your feedback on Copilot code review. Take the survey.

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Mar 12, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Mar 12, 2026

Merge activity

#20255)

The same as #20254 for Oxlint.

The refactoring to move the logic to the JS side is being addressed in a subsequent PR. (Copilot review will be also addressed)
@graphite-app graphite-app bot force-pushed the 03-12-fix_oxfmt_skip_vite.config.ts_w_o_.fmt_field_in_auto-discovery branch from 079cd61 to 11a2b45 Compare March 12, 2026 04:14
@graphite-app graphite-app bot force-pushed the 03-12-fix_oxlint_skip_vite.config.ts_w_o_.lint_field_in_auto-discovery branch from 2f76cfd to cc89dbf Compare March 12, 2026 04:15
Base automatically changed from 03-12-fix_oxfmt_skip_vite.config.ts_w_o_.fmt_field_in_auto-discovery to main March 12, 2026 04:25
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 12, 2026
@graphite-app graphite-app bot merged commit cc89dbf into main Mar 12, 2026
20 checks passed
@graphite-app graphite-app bot deleted the 03-12-fix_oxlint_skip_vite.config.ts_w_o_.lint_field_in_auto-discovery branch March 12, 2026 04:26
leaysgur added a commit that referenced this pull request Mar 12, 2026
# Oxlint
### 🐛 Bug Fixes

- 4ea67de oxlint,oxfmt: Skip `vite.config.ts` exports `defineConfig(fn)`
(#20260) (leaysgur)
- cc89dbf oxlint: Skip `vite.config.ts` w/o `.lint` field in
auto-discovery (#20255) (leaysgur)
- 89b7ca9 linter/no-duplicate-imports: Only check aggregated exports
(#20178) (kennytm)
- 691f556 linter/explicit-module-boundary-types: Ignore constructor
callbacks (#20221) (camc314)

### ⚡ Performance

- d160dca linter/plugins: Reduce array lookups in visitor compilation
(#20249) (overlookmotel)

### 📚 Documentation

- 0c7da4f linter: Fix extra closing brace in example config. (#20253)
(connorshea)
- 13606c3 linter/plugins: Update conformance README (#20234)
(overlookmotel)
# Oxfmt
### 🐛 Bug Fixes

- 4ea67de oxlint,oxfmt: Skip `vite.config.ts` exports `defineConfig(fn)`
(#20260) (leaysgur)
- 11a2b45 oxfmt: Skip `vite.config.ts` w/o `.fmt` field in
auto-discovery (#20254) (leaysgur)

Co-authored-by: leaysgur <6259812+leaysgur@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants